<%-- 
    Document   : buyProduct
    Created on : Apr 11, 2013, 1:58:12 AM
    Author     : dizonfarleyjr
--%>

<%@page import="UserManager.ProductManager"%>
<%@page import="UserManager.Product"%>
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <link href="styles/style.css" rel="stylesheet" type="text/css" media="all"/>
        <!-- JS -->
	<script src="script/jquery-1.4.1.min.js" type="text/javascript"></script>	
	<script src="script/jquery.jcarousel.pack.js" type="text/javascript"></script>	
	<script src="script/jquery-func.js" type="text/javascript"></script>	
	<!-- End JS -->
        <title>FooBar Shop!</title>
    </head>
    <body>
     <% 
           Product results = (Product) session.getAttribute("ProdData");
      if(session.getAttribute("loggedUserType") == null)
         response.sendRedirect("viewProductServlet?productid="+results.getProductID());
      else if("Product Manager - AudioCD".equals(session.getAttribute("loggedUserType")))
         response.sendRedirect("viewProductServlet?productid="+results.getProductID());
      else if("Product Manager - Magazine".equals(session.getAttribute("loggedUserType")))
         response.sendRedirect("viewProductServlet?productid="+results.getProductID());
      else if("Product Manager - DVD".equals(session.getAttribute("loggedUserType")))
         response.sendRedirect("viewProductServlet?productid="+results.getProductID());
      else if("Product Manager - Book".equals(session.getAttribute("loggedUserType")))
         response.sendRedirect("bookProductManager.jsp");     
      else if("Accounting Manager".equals(session.getAttribute("loggedUserType")))
         response.sendRedirect("AccountingManager.jsp");

%>
     <!-- Start Shell -->
      <div class="shell">
	<!-- Header -->	
	<div id="header">
		<h1 id="logo"><a href="index.jsp">ALDIGOY</a></h1>	
		
                <!-- Cart -->
		<div id="cart">

                    <%if("Customer".equals(session.getAttribute("loggedUserType"))){ %>
			<a href="#" class="cart-link">Your Shopping Cart</a>
			<div class="cl">&nbsp;</div>
			<span>Welcome, <%= session.getAttribute("loggedName") %>!</span>
			&nbsp;&nbsp;
                        <%}%>
                     
		</div>
		<!-- End Cart -->
		
		<!-- Navigation -->
		<div id="navigation">
                    <%if(session.getAttribute("loggedUserType") == null){ %>
			<ul>
			    <li><a href="index.jsp">Home</a></li>
			    <li><a href="register.jsp">Register</a></li>
			    <li><a href="login.jsp">Login</a></li>
			    <li><a href="#">About Us</a></li>
			</ul>
                        <%}%>
                     <%if("Customer".equals(session.getAttribute("loggedUserType"))){ %>
			<ul>
			    <li><a href="loggedin.jsp" class="active">Home</a></li>
			    <li><a href="viewUserServlet">My Account</a></li>
                            <li><a href="logoutServlet">Logout</a></li>
                            <li><a href="#">About Us</a></li>
			</ul>
                      <%}%>
                      <%if("Product Manager - Book".equals(session.getAttribute("loggedUserType"))){ %>
			<ul>
			    <li><a href="bookProductManager.jsp" class="active">Home</a></li>
			    <li><a href="bookAddProduct.jsp">Add Product (Book)</a></li>
                            <li><a href="m_changePassword.jsp">Change Password</a></li>
                            <li><a href="logoutServlet">Logout</a></li>
			</ul>
                      <%}%>
                      <%if("Product Manager - AudioCD".equals(session.getAttribute("loggedUserType"))){ %>
			<ul>
			    <li><a href="bookProductManager.jsp" class="active">Home</a></li>
			    <li><a href="bookAddProduct.jsp">Add Product (Audio CD)</a></li>
                            <li><a href="m_changePassword.jsp">Change Password</a></li>
                            <li><a href="logoutServlet">Logout</a></li>
			</ul>
                      <%}%>
                      <%if("Product Manager - Magazine".equals(session.getAttribute("loggedUserType"))){ %>
			<ul>
			    <li><a href="bookProductManager.jsp" class="active">Home</a></li>
			    <li><a href="bookAddProduct.jsp">Add Product (Magazine)</a></li>
                            <li><a href="m_changePassword.jsp">Change Password</a></li>
                            <li><a href="logoutServlet">Logout</a></li>
			</ul>
                      <%}%>
                      <%if("Product Manager - DVD".equals(session.getAttribute("loggedUserType"))){ %>
			<ul>
			    <li><a href="bookProductManager.jsp" class="active">Home</a></li>
			    <li><a href="bookAddProduct.jsp">Add Product (DVD)</a></li>
                            <li><a href="m_changePassword.jsp">Change Password</a></li>
                            <li><a href="logoutServlet">Logout</a></li>
			</ul>
                      <%}%>
		</div>
		<!-- End Navigation -->
	</div>
	<!-- End Header -->
	
	<!-- Main -->
	<div id="main">
		<div class="cl">&nbsp;</div>
		
		<!-- Content  lagay ng if results.getcount <= pagelimit(limit)-->
		<div id="content">
                    
                    
                    
                    <div class="box">
                    <b><i><h2><%=results.getTitle()%></h2></i></b></div>
                    <strong><img src="styles/images/products/prod<%=results.getProductID()%>.jpg" alt="" /></strong></a>
                    <table>
                    <tr><td>&nbsp;</td></tr>
                    <tr>
                         <td style="color:maroon"><u><b>Category </b></u></td><td>&nbsp;</td>
                    </tr>
                    <tr>
                        <%if("book".equals(results.getProductType())){%>
                        <td>Books</td>
                        <%}%>
                        <%if("magazine".equals(results.getProductType())){%>
                        <td>Magazines</td>
                        <%}%>
                        <%if("audioCD".equals(results.getProductType())){%>
                        <td>Audio CD</td>
                        <%}%>
                        <%if("dvd".equals(results.getProductType())){%>
                        <td>DVD</td>
                        <%}%>
                    </tr>
                    <tr><td>&nbsp;</td></tr>
                    <tr>
                         <td style="color:maroon"><u><b>Summary </b></u></td><td>&nbsp;</td>
                    </tr>
                    <tr>
                        <td><%=results.getSummary()%></td>
                    </tr>
                    <tr><td>&nbsp;</td></tr>
                    <tr>
                         <td style="color:maroon"><u><b>Price </b></u></td><td>&nbsp;</td>
                    </tr>
                    <tr>
                        <td><%=results.getPrice()%></td>
                    </tr>
                    <tr><td>&nbsp;</td></tr>
                    <tr>
                         <td style="color:maroon"><u><b>Remaining Stock </b></u></td>
                    </tr>
                    <tr>
                        <td><%=results.getStock()%></td>
                    </tr>
                    <tr>
                        <td>&nbsp;</td>
                    </tr>
                    <tr>
                        <td><form name="buyProductForm" method="POST" action="purchaseProduct?productid=<%=results.getProductID()%>&productprice=<%=results.getPrice()%>" style="color:maroon"><u><b>Quantity</b></u></td>
                    </tr>
                    <tr>
                        <td><input type="text" name="quantityValue"value="1"/></td>
                    </tr>
                    <tr>
                        <td><input type="submit" name="checkoutButton" value="Checkout &NestedGreaterGreater;" class="long-submit"></form></td>
                    </tr>
                    </table>
                <table>
                    <tr><td>&nbsp;</td></tr>
                    <tr>
                        <td><form name="cancelEditForm" method="POST" action="viewProductServlet?productid=<%=results.getProductID()%>"><input type="submit" name="cancelEditButton" value="Cancel" class="search-submit"></form></td>
                    </tr>
                </table>
                    
                
                
                    
             
		</div>
		<!-- End Content -->
		
		<!-- Sidebar -->
		<div id="sidebar">
			
			<!-- Search -->
			<div class="box search">
				<h2>Search by <span></span></h2>
				<div class="box-content">
					<form action="searchProductServlet" method="post">
						
						<label>Keyword</label>
						<input type="text" class="field" name="searchKeyword" />
						
						<label>Category</label>
						<select class="field" name="searchCategory">
							<option value="All Categories">All Categories</option>
                                                        <option value="book">Books</option>
                                                        <option value="magazine">Magazines</option>
                                                        <option value="audioCD">Audio CD</option>
                                                        <option value="dvd">DVD</option>
						</select>
						
						
						<input type="submit" class="search-submit" value="Search" />
						
						<p>
							<a href="#" class="bul">Advanced search</a><br />
							<a href="#" class="bul">Contact Customer Support</a>
						</p>
	
					</form>
				</div>
			</div>
			<!-- End Search -->
			
			<!-- Categories -->
			<div class="box categories">
				<h2>Categories <span></span></h2>
				<div class="box-content">
					<ul>
					    <li><a href="viewCategoryServlet?productCategory=book">Books</a></li>
					    <li><a href="viewCategoryServlet?productCategory=magazine">Magazines</a></li>
					    <li><a href="viewCategoryServlet?productCategory=audioCD">Audio CD</a></li>
					    <li><a href="viewCategoryServlet?productCategory=dvd">DVD</a></li>
                                            <li><a href="viewCategoryServlet?productCategory=all">View All Products</a></li>
                                            <%if("Product Manager - Book".equals(session.getAttribute("loggedUserType"))){%>
                                            <li class="last"><a href="viewDiscontinued">View Discontinued Products</a></li>
                                            <%}%>
                                            <%if("Product Manager - Magazine".equals(session.getAttribute("loggedUserType"))){%>
                                            <li class="last"><a href="viewDiscontinued">View Discontinued Products</a></li>
                                            <%}%>
                                            <%if("Product Manager - DVD".equals(session.getAttribute("loggedUserType"))){%>
                                            <li class="last"><a href="viewDiscontinued">View Discontinued Products</a></li>
                                            <%}%>
                                            <%if("Product Manager - AudioCD".equals(session.getAttribute("loggedUserType"))){%>
                                            <li class="last"><a href="viewDiscontinued">View Discontinued Products</a></li>
                                            <%}%>
                                        </ul>
				</div>
			</div>
			<!-- End Categories -->
			
		</div>
		<!-- End Sidebar -->
		
		<div class="cl">&nbsp;</div>
	</div>
	<!-- End Main -->
	
	<!-- Side Full -->
	<div class="side-full">
		
		<!-- More Products -->
		<div class="more-products">
			<div class="more-products-holder">
				<ul>
				    <li><a href="#"><img src="styles/images/prod1.jpg" alt="" /></a></li>
				    <li><a href="#"><img src="styles/images/prod2.jpg" alt="" /></a></li>
				    <li><a href="#"><img src="styles/images/prod3.jpg" alt="" /></a></li>
				    <li><a href="#"><img src="styles/images/prod4.jpg" alt="" /></a></li>
				    <li><a href="#"><img src="styles/images/prod5.jpg" alt="" /></a></li>
				    <li><a href="#"><img src="styles/images/prod6.jpg" alt="" /></a></li>
                                    <li><a href="#"><img src="styles/images/prod8.jpg" alt="" /></a></li>
				    <li><a href="#"><img src="styles/images/prod9.jpg" alt="" /></a></li>
				    <li><a href="#"><img src="styles/images/prod10.jpg" alt="" /></a></li>
				    <li><a href="#"><img src="styles/images/prod11.jpg" alt="" /></a></li>
				    <li class="last"><a href="#"><img src="styles/images/prod7.jpg" alt="" /></a></li>
				</ul>
			</div>
			<div class="more-nav">
				<a href="#" class="prev">previous</a>
				<a href="#" class="next">next</a>
			</div>
		</div>
		<!-- End More Products -->
		
		<!-- Text Cols -->
		<div class="cols">
			<div class="cl">&nbsp;</div>
			<div class="col">
				<h3 class="ico ico1">Fast Delivery</h3>
				<p>We offer one of the fastest delivery services in the whole world.</p>
				<p class="more"><a href="#" class="bul">Learn more</a></p>
			</div>
			<div class="col">
				<h3 class="ico ico2">Customer Service</h3>
				<p>Inquire and learn more about products by talking with our friendly staff.</p>
				<p class="more"><a href="#" class="bul">Learn more</a></p>
			</div>
			<div class="col">
				<h3 class="ico ico3">Gift Service</h3>
				<p>Browsing for a gift? Look no further, we offer one of the safest and most incredible services out there.</p>
				<p class="more"><a href="#" class="bul">Learn more</a></p>
			</div>
			<div class="col col-last">
				<h3 class="ico ico4">Shopping Cart</h3>
				<p>Got everything that you're looking for? Checkout your shopping cart now!.</p>
				<p class="more"><a href="#" class="bul">Finish Shopping</a></p>
			</div>
			<div class="cl">&nbsp;</div>
		</div>
		<!-- End Text Cols -->
		
	</div>
	<!-- End Side Full -->
	
	<!-- Footer -->
	<div id="footer">
		<p class="left">
			<a href="#">Home</a>
			<span>|</span>
			<a href="#">Register</a>
			<span>|</span>
			<a href="#">Login</a>
			<span>|</span>
			<a href="#">About Us</a>
			<span>|</span>
			
		</p>
		<p class="right">
			&copy; 2013 FooBar Shop.
			
		</p>
	</div>
	<!-- End Footer -->
	
</div>	
<!-- End Shell -->
      
      
      
      
    </body>
</html>


